package com.ruoyi.project.mgcmanage.service.impl;

import com.ruoyi.project.mgcmanage.domain.Purchase;
import com.ruoyi.project.mgcmanage.mapper.PurchaseMapper;
import com.ruoyi.project.mgcmanage.service.IPurchaseService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurchaseServiceImpl implements IPurchaseService {
    @Autowired
    private PurchaseMapper purchaseMapper;

    @Override
    public List<Purchase> getList(Purchase purchase) {
        return purchaseMapper.selectList(purchase);
    }

    @Override
    public Purchase selectById(int noId) {
        return purchaseMapper.selectOne(noId);
    }

    @Override
    public int updateStatus(int noId) {
        Purchase purchase = purchaseMapper.selectOne(noId);
        if (purchase.getPurchaseStatus()==2){
            return purchaseMapper.updateStatus2(noId);
        }
        return purchaseMapper.updateStatus(noId);
    }

    @Override
    public int deleteStorage(int[] noIds) {
        return purchaseMapper.delete(noIds);
    }

    @Override
    public List<Purchase> getList2() {
        return purchaseMapper.selectList2();
    }

   /* @Override
    public int updateStatus2(int noIds2) {
        return purchaseMapper.updateStatus2(noIds2);
    }*/
}
